package com.crx.springbootinit.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.crx.springbootinit.model.dto.chat.ChatPageDTO;
import com.crx.springbootinit.model.entity.Chat;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.crx.springbootinit.model.vo.chat.ChatListVO;
import com.crx.springbootinit.model.vo.chat.ChatVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 聊天消息表 Mapper 接口
 * </p>
 *
 * @author author
 * @since 2024-10-21
 */
public interface ChatMapper extends BaseMapper<Chat> {
    List<Chat> selectChattedList(@Param("userId") Long userId,
                                 @Param("pageSize") int pageSize,
                                 @Param("offset") int offset);

    IPage<ChatVO> queryChatPage(Page<ChatVO> page, @Param("chatPageDTO") ChatPageDTO chatPageDTO);

    List<ChatListVO> getHistoryChatList(@Param("userId") Long userId,
                                        @Param("targetId") Long targetId,
                                        @Param("pageSize") int pageSize,
                                        @Param("offset") int offset);

    Long countChattedList(@Param("userId") Long userId);
}
